package com.csair.platform.cit.service.config;


import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.dao.annotation.PersistenceExceptionTranslationPostProcessor;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;

import com.csair.platform.jpa.dao.PlatformBaseRepositoryImpl;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationFeature;

@Configuration
@EnableJpaRepositories(basePackages = "com.csair.platform.cit.**.dao", repositoryBaseClass = PlatformBaseRepositoryImpl.class)
@EntityScan(basePackages = {"com.csair.platform.cit.**.entity",
		"com.csair.platform.cit.**.model"})
public class JpaConfig {

	@Bean
    PersistenceExceptionTranslationPostProcessor persistenceExceptionTranslationPostProcessor(){
        return new PersistenceExceptionTranslationPostProcessor();
    }
	
	@Bean
	public ObjectMapper objectMapper() {
	     return new ObjectMapper().disable(SerializationFeature.FAIL_ON_EMPTY_BEANS);
	}

}
